package com.zyh.kaoshi;

import java.util.Scanner;

//wo ai java i love javajajajavavava
public class Test3 {
    public static void main(String[] args) {
        System.out.println("请输入一个字符串：");
        String input = new Scanner(System.in).nextLine();
        System.out.println("请输入指定查找的字符串：");
        String search = new Scanner(System.in).nextLine();
        for (int i = 0; i < input.length(); i++) {
             int index = input.indexOf(search, i);
            if (index == -1) {
                break;
            }
            System.out.println(search + "出现在" + index + "位置");
            i=index;
        }
    }
}
